import axios from "axios";


axios.defaults.baseURL = "http://localhost:3008/api/";


// 用户登录
export const UserLogin = (params) => {
    return axios.post("user/login", params).then(res => res.data)
};

// 用户列表
export const UserList = (params) => {
    return axios.get(`user/userlist?page=${params.page}&size=${params.size}`).then(res => res.data)
};

// 修改用户
export const EditUser = (params) => {
    return axios.post(`user/edituser`, params).then(res => res.data)
};

// 修改is_show
export const EditIsShow = (params) => {
    return axios.post(`user/editshow`, params).then(res => res.data)
};

// 删除用户
export const DeleUser = (params) => {
    return axios.get(`user/deleteuser?user_id=${params.user_id}`).then(res => {
        res.data;
    })
};

// 添加用户
export const Adduser = (params) => {
    return axios.post(`user/register`, params).then(res => res.data)
};



// 所有数据
export const alluserlist = () => {
    return axios.get('user/allusers').then(res => res.data)
};


//分类列表
export const categorylist = (params) => {
    return axios.get(`category/categorylist?page=${params.page}&size=${params.size}`).then(res => res.data)
};